home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
science
/
sm32a.zip
/
LIBRARY
/
GAMMA.LI
< prev
next >
Wrap
Text File
|
1993-11-14
|
1KB
|
32 lines
# gamma.(x)
# gamma(n) is the gamma function Γ(n),
# gamma(n)=inte(t^(n-1)*e^(-t), t from 0 to inf).
# gamma(n)=(n-1)!.
# gamma(n,x) is the incomplete gamma function, gamma(n,x)=
# inte(t^n*e^(-t), t,0,x), d(gamma(n,x),x)=x^n*e^(-x).
# gamma(n,0)=0, gamma(n,inf)=gamma(n+1)=n!.
# gamma(n,x) is similar to gamma(n), but its power term is t^n, instead
# of t^(n-1).
# See also: ei, gamma, li.
# d(gamma(n_,x_),x_):= x^n*e^-x
# d(gamma(x_) ,x_) := gamma(x)*polygamma(x)
gamma(1/2) := sqrt(pi)
gamma(1) := 1
gamma(2) := 1
gamma(inf) := inf
#gamma(n_) := if(n>1, if(isinteger(n), (n-1)!, (n-1)*gamma(n-1)))
gamma(n_) := if( n>1 and isinteger(n), (n-1)! )
gamma(x_) := if( x>0 and numeric==on, sqrt(2*pi)*x^(x-0.5)*e^(-x)*(1+1/12/x) )
gamma(n_,0):=0
gamma(n_,inf):=gamma(n+1)
gamma(-1,x_) := ei(-x)
gamma(0,x_) := -e^-x
gamma(-0.5,x_) := sqrt(pi)*erf(sqrt(x))
gamma(-1/2,x_) := sqrt(pi)*erf(sqrt(x))
#gamma(n_,x_) := if(n >= 1, n*gamma(n-1,x)-x^n*e^-x,
if(n < -1, (gamma(n+1,x)-x^(n+1)*e^-x)/(n+1)) )